package com.linser.gistools.refactoring.javafx.treeitem;

import com.linser.gistools.common.datastore.model.BaseDataStoreModel;
import javafx.scene.Node;
import javafx.scene.control.TreeItem;

/**
 * @author: linser
 * @Desc: 数据库类型的 TreeItem
 * @create: 2024-01-26
 */
public class DBClientTreeItem extends TreeItem<String> {
    private BaseDataStoreModel baseDataStoreModel;

    public DBClientTreeItem(BaseDataStoreModel baseDataStoreModel) {
        super(baseDataStoreModel.getDbInfo().getName() != null? baseDataStoreModel.getDbInfo().getName(): baseDataStoreModel.getDbInfo().getDatabase());
        this.baseDataStoreModel = baseDataStoreModel;
    }

    public DBClientTreeItem() {
        super();
    }

    /**
     * Creates a TreeItem with the value property set to the provided object, and
     * the graphic set to the provided Node.
     *
     * @param value The object to be stored as the value of this TreeItem.
     * @param graphic The Node to show in the TreeView next to this TreeItem.
     */
    public DBClientTreeItem(String value, final Node graphic) {
        super(value,graphic);
    }


    public BaseDataStoreModel getDataStoreModel(){
        return this.baseDataStoreModel;
    }
    public void setDataStoreModel(BaseDataStoreModel baseDataStoreModel){
        this.baseDataStoreModel = baseDataStoreModel;
    }
}
